using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Xml;
using NET.Library.Types;

namespace NET.Library.XML
{
    /// <summary>
    /// 
    /// </summary>
    public class XMLHelper
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static int GetXMLInt(XmlNode node)
        {
            //Get value
            return Integers.IntGetVal(node.Value); 
                //DBHelper.intValue(node.Value);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="document"></param>
        /// <param name="elementId"></param>
        /// <returns></returns>
        public static int GetXMLInt(XmlDocument document, string elementId)
        {
            //Get value
            return Integers.IntGetVal(document.GetElementById(elementId).Value); 
                //DBHelper.intValue(document.GetElementById(elementId).Value);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static bool GetXMLBool(XmlNode node)
        {
            //Get value
            return Booleans.boolGetValue(node.Value); 
                //DBHelper.boolValue(node.Value);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="document"></param>
        /// <param name="elementId"></param>
        /// <returns></returns>
        public static bool GetXMLBool(XmlDocument document, string elementId)
        {
            //Get value
            return Booleans.boolGetValue(document.GetElementById(elementId).Value); 
                //DBHelper.boolValue(document.GetElementById(elementId).Value);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataSet"></param>
        /// <returns></returns>
        public static XmlDocument GetXMLDataSet(DataSet dataSet)
        {
            return new XmlDataDocument(dataSet);
        }
    }
}
